package com.yc.example.message;

import android.text.TextUtils;

import com.yc.mvplib.utlis.SPUtil;


/**
 * 描述：用户逻辑
 * 创建者：  Churck
 * 创建时间：16/9/19 10:39
 * 修改者： Churck
 * 修改时间：16/9/19 10:39
 * 版 本：v1.0
 */
public class UserMessage {
    private boolean isupdata;
    private String id = "0";
    private String blanne = "0";
    private boolean isRSplash=true;
    private String type = null;
    private String userid = null;
    private String imei = null;
    private String shoparray;
    private static volatile UserMessage instance = null;
    private  double[] points = null;
    public static UserMessage getInstance() {
        if (instance == null) {
            synchronized (UserMessage.class) {
                if (instance == null) {
                    instance = new UserMessage();
                }
            }
        }
        return instance;
    }

    public boolean isupdata() {
        return isupdata;
    }

    public void setIsupdata(boolean isupdata) {
        this.isupdata = isupdata;
    }

    public String getBlanne() {
        return blanne;
    }

    public void setBlanne(String blanne) {
        this.blanne = blanne;
    }

    public boolean isRSplash() {
        return isRSplash;
    }

    public void setRSplash(boolean RSplash) {
        isRSplash = RSplash;
    }

    public String getId() {
        return id;
    }

    public String getShoparray() {
        return shoparray;
    }

    public void setShoparray(String shoparray) {
        this.shoparray = shoparray;
    }

    public void setId(String id) {
        this.id = id;
    }


    /**
     * 获取用户id
     *
     * @return
     */
    public String getUserid() {
        if (TextUtils.isEmpty(userid)) {

            String fileuserid = SPUtil.getInstance().getString("userid", "");
            userid = fileuserid;
        }
        return userid;
    }

    public void setUserid(String usercode) {
        SPUtil.getInstance().putString("userid", usercode);
        userid = usercode;
    }

    public void setPluginType(String mtype) {
        SPUtil.getInstance().putString("pluginType", mtype);
        type = mtype;
    }

    public String getPluginType() {
        if (TextUtils.isEmpty(type)) {
            String wtype = SPUtil.getInstance().getString("pluginType", "");
            type = wtype;
        }
        return type;
    }

    public void setImei(String mimei) {
        SPUtil.getInstance().putString("imei", mimei);
        imei = mimei;
    }

    public String getimei() {
        if (TextUtils.isEmpty(imei)) {
            String wimei = SPUtil.getInstance().getString("imei", "");
            imei = wimei;
        }
        return imei;
    }
    public void clean() {
        SPUtil.getInstance().putString("userid", "");
        userid = null;
    }
}
